package com.example.java2e.Service.Impl;

import com.example.java2e.Dao.UserDao;
import com.example.java2e.Entity.Driver;
import com.example.java2e.Entity.Manager;
import com.example.java2e.Entity.User;
import com.example.java2e.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class UserServiceImpl implements UserService
{
    @Autowired
    private UserDao userDao;//调用数据库
    @Override
    public User selectUserByTel(String tel) {
        return userDao.selectUserByTel(tel);
    }
    @Override
    public User selectUserById(String id) {
        return userDao.selectUserById(id);
    }
    @Override
    public void deleteUserById(String id){ userDao.deleteUserById(id); }
    @Override
    public void registerNewUser(User new_user) {
        userDao.registerNewUser(new_user);
    }
    @Override
    public Manager selectManagerByTel(String tel) {
        return userDao.selectManagerByTel(tel);
    }
    @Override
    public Manager selectManagerById(String id) {
        return userDao.selectManagerById(id);
    }
    @Override
    public void deleteManagerById(String id){ userDao.deleteManagerById(id); }
    @Override
    public void registerNewManager(Manager new_manager) { userDao.registerNewManager(new_manager); }
    @Override
    public Driver selectDriverById(String id) {
        return userDao.selectDriverById(id);
    }
    @Override
    public void deleteDriverById(String id){ userDao.deleteDriverById(id); }
    @Override
    public ArrayList<Driver> selectDriverList(){ return userDao.selectDriverList(); }
    @Override
    public void registerNewDriver(Driver new_driver){ userDao.registerNewDriver(new_driver); }
}
